﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TR.AppService.Dto;
using TR.AppService.Dto.WHOMDto;
using TR.Domain.Entity.WHOB;
using TR.Domain.Repository.WHOM_SelectRepository;

namespace TR.AppService.AppService.WHOM_Selected
{
    public class WHOM_SelectAppService : IWHOM_SelectAppService
    {
        private readonly IWHOB_SelectRepository Wsr;
        private readonly IMapper mapper;

        public WHOM_SelectAppService(IWHOB_SelectRepository Wsr, IMapper mapper)
        {
            this.Wsr = Wsr;
            this.mapper = mapper;
        }

        //分页查询
        public async Task<DtoFenYe<WHOB_Select>> WHOB_FenYeSelect(int mys, int dqy, string? qsj, string? hsj, WHOM_SelectDto ws)
        {
            var listFenYe = await Wsr.WHCZ(mys, dqy, qsj, hsj, ws);
            var zts = await Wsr.WHShu();
            var res = new DtoFenYe<WHOB_Select>()
            {
                mys = mys,
                dqy = dqy,
                list = listFenYe,
                zts = zts
            };
            return res;
        }

        //逻辑删除
        public async Task<bool> WHOBDeleteAsync(List<int> isdel)
        {
            return await Wsr.WHOBDeleteAsync(isdel);
        }

        //批量修改状态
        public async Task<bool> StaticUpdateAsync(List<int> Bian, char zt)
        {
            return await Wsr.StaticUpdateAsync(Bian, zt);
        }

        //批量审核
        public async Task<bool> SHUpdateAsync(List<int> Bina, char states, string sureman, string suredate, string remark)
        {
            return await Wsr.SHUpdateAsync(Bina, states,sureman,suredate,remark);
        }

        //批量撤销
        public async Task<bool> CXUpdateAsync(List<int> Bian)
        {
            return await Wsr.CXUpdateAsync(Bian);
        }

        //单行逻辑删除
        public async Task<bool> DHDelete(int Bian)
        {
            return await Wsr.DHDelete(Bian);
        }
    }
}
